
import Taro from '@tarojs/taro';
const KEY = 'searchKeys';
class searchStorage {

  static get(){
    try {
      let value = Taro.getStorageSync(KEY);
      if (value === undefined)
        return  []
      return JSON.parse(value);
    } catch (e) {
      return []
    }
  }

  static save(value){
    try {
      Taro.setStorageSync(KEY, JSON.stringify(value))
    } catch (e) { }
  }

  static clear(){
    try {
      Taro.removeStorageSync(KEY)
    } catch (e) {
      // Do something when catch error
    }
  }

}

export default searchStorage
